import Hero from './Hero';
const { ccclass, property } = cc._decorator;

@ccclass
export default class Game extends cc.Component {


    @property(cc.TiledMap)
    tiled: cc.TiledMap = null;

    floorLayer: cc.TiledLayer = null;
    wallLayer: cc.TiledLayer = null;
    tiemLayer: cc.TiledLayer = null;
    doorLayer: cc.TiledLayer = null;
    enemyLayer: cc.TiledLayer = null;
    heroLayer: cc.TiledLayer = null;

  


    onLoad() {

        // let manage = cc.director.getPhysicsManager();
        // manage.enabled = true;
        // manage.debugDrawFlags =
        //     cc.PhysicsManager.DrawBits.e_aabbBit |
        //     cc.PhysicsManager.DrawBits.e_jointBit |
        //     cc.PhysicsManager.DrawBits.e_shapeBit;

        this.floorLayer = this.tiled.getLayer('floor');
        this.wallLayer = this.tiled.getLayer('wall');
        this.tiemLayer = this.tiled.getLayer('item');
        this.doorLayer = this.tiled.getLayer('door');
        this.enemyLayer = this.tiled.getLayer('enemy');
        this.heroLayer = this.tiled.getLayer('hero');

        this.initEnemy();

       
    }

    initEnemy() {
        let s = this.enemyLayer.getLayerSize();

        for (let y = 0; y < s.height; y++) {
            for (let x = 0; x < s.width; x++) {
                let gid = this.enemyLayer.getTileGIDAt(cc.v2(x, y))
                if (gid != -1) {

                }
            }
        }
    }

    combat(){

    }

    start() {

    }

    // update (dt) {}
}
